package com.zh.core;

/**
 * Created by zhaohui on 2019/9/7
 * Description:
 */
public class ThreadTest {

    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        String[] words = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j"};
        Runnable r1 = () -> {
            for (int i : nums) {
                System.out.println(i);
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        Runnable r2 = () -> {
            for (String word : words) {
                System.out.println(word);
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        Thread t1 = new Thread(r1);
        Thread t2 = new Thread(r2);
        t1.start();
        t2.start();

    }

}
